﻿
@{
    ViewBag.Title = "SysChargeProjPriceAdj";
    Layout = "~/Views/Shared/_Index.cshtml";
}

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        @*<div class="btn-group">
            <a id="NF-add" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建</a>
        </div>*@
        @*<div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                <li><a id="NF-edit" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改信息</a></li>
                <li><a id="NF-delete" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除信息</a></li>
                <li><a id="NF-Details" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看信息</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>*@
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="收费项目" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
</div>

<script>
    $(function () {
        gridList();
    });
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            treeGrid: true,
            treeGridModel: "adjacency",
            url: "/SystemManage/SysChargeProjPriceAdj/GetGridJson",
            height: 470,
            colModel: [
                { label: '主键', name: 'tjbh', hidden: true, key: true },
                { label: '收费项目', name: 'sfxm', width: 100, algin: 'left' },
                { label: '收费项目名称', name: 'sfxmmc', width: 100, algin: 'left' },
                { label: '单价', name: 'dj', width: 100, algin: 'left' },
                { label: '自付比例', name: 'zfbl', width: 100, algin: 'left' },
                {
                    label: '自付性质', name: 'zfxz', width: 80, align: 'left',
                    formatter: function (cellvalue) {
                        if (cellvalue == "0") {
                            return "自付";
                        } else if (cellvalue == "1") {
                            return "自理";
                        }
                    }
                },
                {
                    label: '状态', name: 'zt', width: 100, algin: 'left',
                    formatter: function (cellvalue) {
                        if (cellvalue == 0) {
                            return "否";
                        } else {
                            return "是";
                        }
                    }
                },
                {
                    label: '执行标志', name: 'zxbz', width: 100, algin: 'left',
                    formatter: function (cellvalue) {
                        if (cellvalue == 0) {
                            return "未执行";
                        } else {
                            return "已执行";
                        }
                    }
                },
                {
                    label: '执行日期', name: 'zxrq', width: 100, align: 'left',
                    formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
                },
                {
                    label: '定点生效日期', name: 'ddsxrq', width: 100, algin: 'left',
                    formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
                },
                {
                    label: '生效标志', name: 'sxbz', width: 100, algin: 'left',
                    formatter: function (cellvalue) {
                        if (cellvalue == 0) {
                            return "即时生效";
                        } else {
                            return "定点生效";
                        }
                    }
                },
                {
                    label: '建档日期', name: 'CreateTime', width: 100, align: 'left',
                    formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
                },
               { label: '建档人员', name: 'CreatorCode', width: 80, align: 'left' }
            ]
        });

        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val() }
            }).trigger('reloadGrid');
        })

    }

    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "系统收费项目调价维护",
            url: "/SystemManage/SysChargeProjPriceAdj/Form",
            width: "700px",
            height: "300px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }

    //function btn_edit() {
    //    var keyValue = $("#gridList").jqGridRowValue().brsfjmbh;
    //    $.modalOpen({
    //        id: "Form",
    //        title: "修改信息",
    //        url: "/SystemManage/SysChargeProjPriceAdj/Form?keyValue=" + keyValue,
    //        width: "700px",
    //        height: "300px",
    //        callBack: function (iframeId) {
    //            top.frames[iframeId].submitForm();
    //        }
    //    });
    //}
    function btn_delete() {
        $.deleteForm({
            url: "/SystemManage/SysChargeProjPriceAdj/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().brsfjmbh },
            success: function () {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().brsfjmbh;
        $.modalOpen({
            id: "Details",
            title: "查看机构",
            url: "/SystemManage/SysChargeProjPriceAdj/Form?keyValue=" + keyValue,
            width: "700px",
            height: "300px",
            btn: null,
        });
    }
</script>

